<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>

<body>
  <div id="app"></div>

  <script>
    const { createApp } = Vue
    createApp({
      template: `<h2 id="h2">{{count}}</h2>
                  <button id="minus" @click="minus">-1</button>
                  <button id="add" @click="add">+1</button>`,
      data: function() {
        return {  // 响应式
          count: 10
        }
      },
      methods: {
        minus() {
          this.count--
        },
        add: function() {
          this.count++;
        }
      }
    }).mount('#app')


  </script>
</body>

</html>